<template>
  <Participant :value="participant"
               :icon-name="iconName"
               :content="content"
               tagClass="from"
               tagName="发" />
</template>

<script>
import WaybillMixin from "./waybill.mixin";
import Participant from "@/components/basic/Participant.vue";
export default {
  name: "WaybillCustomer",
  components: { Participant },
  mixins: [WaybillMixin],
  props: ["value"],
  computed: {
    participant () {
      const { showCustomerName, customerName } = this.customer;
      const { contactName, contactMobile } = this.fromContact;
      const { city, province, district, address } = this.fromAddress;
      const additionals = [];
      if (this.fromTime) {
        additionals.push("发货时间: " + this.$moment(this.fromTime).format("YYYY-MM-DD HH:mm"));
      }
      return {
        contactName,
        contactMobile,
        name: showCustomerName || customerName,
        city,
        province,
        district,
        address,
        additionals
      };
    },
    content () {
      switch (this.customer?.showCustomerType) {
        case 0:
          return '线下';
        case 1:
          return '线上';
        default:
          return '';
      }
    },
    iconName () {
      switch (this.customer?.showCustomerType) {
        case 0:
          return 'xianxia';
        case 1:
          return 'xianshang';
        default:
          return '';
      }
    }
  }
};
</script>
